// 获取枚举 label
interface Option {
  value: string | number;
  label: string;
  status?: string;
}

// eslint-disable-next-line default-param-last
export const getLabel = (typeList: Option[] = [], type: string | number) => {
  if (!typeList.length || !type) {
    return '-';
  }

  // eslint-disable-next-line
  const item = typeList.find((i) => i.value + '' === type + '');
  if (item && item.label) {
    return item.label;
  }
  return '-';
};

// 菜单类型 枚举
export const typeOptions: Option[] = [
  { value: 'M', label: '目录', status: 'primary' },
  { value: 'C', label: '菜单', status: 'success' },
  { value: 'A', label: '按钮', status: 'danger' },
];
